package com.btl.component.doc;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.lang.NonNull;

public class SwaggerEnableCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, @NonNull AnnotatedTypeMetadata metadata) {
        String activeProfile = context.getEnvironment()
                .getProperty("spring.profiles.active");
        return "dev".equals(activeProfile) || "test".equals(activeProfile);
    }
}